﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Xml;
using System.Data;

using Gift.DAL;
using Gift.Model;
using Gift.WebApp;


public partial class cn_UserControl_category_brand : System.Web.UI.UserControl
{

    protected string moduleSetXmlPath = "/cn/xml/module_set.xml";
    BasePage thePage = new BasePage();

    // Methods
    protected StringBuilder CategoryBrand()
    {
        StringBuilder builder = new StringBuilder();
        try
        {
            XmlDocument document = new XmlDocument();
            document.Load(base.Server.MapPath(this.moduleSetXmlPath));
            XmlElement element = document.SelectSingleNode("set/partner_card_exchange") as XmlElement;
            if (element.GetAttribute("isShow") != "true") return null;

            builder.AppendLine("<div class=\"pro_nav\">");
            builder.AppendLine("<div class=\"content-box\">");
            builder.AppendLine("<div class=\"content-box-header\">");
            builder.AppendLine("<div class=\"more\"></div>");
            builder.AppendLine("<ul class=\"content-box-tabs\">");
            builder.AppendLine("<li><a href=\"#tab3\" class=\"default-tab\">" + element.GetAttribute("title")  +"</a></li>");
           
        
             element = document.SelectSingleNode("set/brand_category") as XmlElement;
            if (element.GetAttribute("isShow") == "true")
            {
                builder.AppendLine("<li><a href=\"#tab4\">" + element.GetAttribute("title") + "</a></li>");
            }
            builder.AppendLine("</ul>");
            builder.AppendLine("</div>");
            builder.AppendLine("<div class=\"content-box-content\">");
            builder.AppendLine("<div class=\"tab-content default-tab\" id=\"tab3\">");

            builder.AppendLine("<ul class=\"brand2\">");
            DataTable tbProfession = BaseFactory.theProfessionAreaType.GetList("").Tables[0];
            foreach (DataRow row2 in tbProfession.Rows)
            {
                builder.AppendLine(string.Concat(new object[] { "<li><a target=\"_blank\" href=\"/cn/goods_list.html?bid=", row2["id"], "\" title=\"", row2["description"], "\"><img src=\"", row2["photoUrl"], "\" alt=\"", row2["description"], "\" />", "<div>" + row2["description"] + "</div>" + "</a></li>" }));
            }
            builder.AppendLine("</ul>");
            builder.AppendLine("<div class=\"clear\"></div>");
            builder.AppendLine("</div>");

            if (element.GetAttribute("isShow") == "true")
            {
                builder.AppendLine("<div class=\"tab-content\" id=\"tab4\">");
                builder.AppendLine("<ul class=\"brand2\">");
                DataTable brandByLanguage = BaseFactory.theBrand.GetBrandByCompanyId(thePage.CompanyId);
                foreach (DataRow row2 in brandByLanguage.Rows)
                {
                    builder.AppendLine(string.Concat(new object[] { "<li><a href=\"/cn/goods_list.html?bid=", row2["id"], "\"><img src=\"", row2["brandLogo"], "\" alt=\"", row2["brandName"], "\" /></a></li>" }));
                }
                builder.AppendLine("</ul>");
                builder.AppendLine("<div class=\"clear\"></div>");
                builder.AppendLine("</div>");
            }
            builder.AppendLine("</div>");
            builder.AppendLine("</div>");
            builder.AppendLine("</div>");
        }
        catch
        {
        }
        return builder;
    }

    protected void Page_Load(object sender, EventArgs e)
    {
    }

}